<!DOCTYPE html>
<html lang="zh">
	<head>
            <meta charset="utf-8" />
            <title>龙虾直播_最娱乐直播平台</title>
            <meta name="description" content="overview &amp; stats" />
            <meta name="viewport" content="width=device-width, initial-scale=1.0" />
            <!-- basic styles -->
            <link href="__PUBLIC__/assets/css/bootstrap.min.css" rel="stylesheet" />
            <link rel="stylesheet" href="__PUBLIC__/assets/css/font-awesome.min.css" />
            <link rel="stylesheet" href="__PUBLIC__/font2/font/css/font-awesome.css" />
            <!--[if IE 7]>
              <link rel="stylesheet" href="__PUBLIC__/assets/css/font-awesome-ie7.min.css" />
            <![endif]-->
            <!-- page specific plugin styles -->
            <!-- fonts -->
            <link rel="stylesheet" href="__PUBLIC__/assets/css/ace-fonts.css" />
            <!-- ace styles -->
            <link rel="stylesheet" href="__PUBLIC__/assets/css/ace.min.css" />
            <link rel="stylesheet" href="__PUBLIC__/assets/css/ace-rtl.min.css" />
            <link rel="stylesheet" href="__PUBLIC__/assets/css/ace-skins.min.css" />
            <link rel="stylesheet" href="__PUBLIC__/krosExt.css" />
            <!--[if lte IE 8]>
              <link rel="stylesheet" href="__PUBLIC__/assets/css/ace-ie.min.css" />
            <![endif]-->
            <!-- inline styles related to this page -->
            <!-- ace settings handler -->
            <script src="__PUBLIC__/assets/js/ace-extra.min.js"></script>
            <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
            <!--[if lt IE 9]>
            <script src="__PUBLIC__/assets/js/html5shiv.js"></script>
            <script src="__PUBLIC__/assets/js/respond.min.js"></script>
            <![endif]-->
            <script type="text/javascript" src="http://web.mcooz.com/js/jquery-1.11.1.min.js"></script>   
            <link href="__PUBLIC__/huojian/css/lrtk.css" rel="stylesheet" type="text/css" />
            <script type="text/javascript" charset="UTF-8" src="http://web.mcooz.com/js_source/artdialog/artDialog.source.js.js"></script>
            <script type="text/javascript" charset="UTF-8" src="http://web.mcooz.com/js_source/artdialog/plugins/iframeTools.source.js"></script>
            <link rel="stylesheet" type="text/css" href="http://web.mcooz.com/js_source/artdialog/skins/idialog.css" />
            <script type="text/javascript" src="__PUBLIC__/huojian/js/lrtk.js"></script>
            <script type="text/javascript" src="__PUBLIC__/js/jquery.easing.1.3.js"></script>
            <script type="text/javascript">
            var _speedMark = new Date();
            </script>
             <script type="text/javascript">
              //WebSocket = null;
              </script>
              <!--<link href="http://chat.mcooz.com/Applications/Chat/Web//css/bootstrap.min.css" rel="stylesheet">-->
              <link href="http://chat.mcooz.com/Applications/Chat/Web//css/style.css" rel="stylesheet">
              <style>
            .say-btn {
              height: 5em;
              float: left;
              margin-top: 0;
              width: 17%
            }	
            .textarea {
              height: 5em;
              width: 83%;
              float: left;
            }
            .btn.btn-default {
              height: 5em;
              width: 100%;
            }
            #rocket-to-top,#rocket-to-top1{
                    top: 1800px;
            }


            .icon-heart {
              cursor: pointer;
            }

            .g-img {
              border: 0 none;
              cursor: pointer;
              height: 45px;
              width: 45px;
              border-radius:4px;
            }

            .huojian,.Atlantis,.artillery,.plane,.ship {
              border-radius: 4px;
              height: 40px;
              line-height: 1;
              padding: 4px;
              position: relative;
              width: 50px;
              float: right;
            }

             .follow-btn {
              background-color: #f70;
              border: 1px solid #e5e5e5;
              border-radius: 18.5px 0 0 18.5px;
              color: #fff;
              height: 25px;
              line-height: 25px;
              width: 69px;
              position: relative;
            }
            .fl {
              float: left;
            }
             .r-num span {
              color: #879aa8;
              display: inline-block;
              height: 25px;
              line-height: 25px;
              padding: 0 9px;
              font-size: 12px;
            }

             .r-num {
              -moz-border-bottom-colors: none;
              -moz-border-left-colors: none;
              -moz-border-right-colors: none;
              -moz-border-top-colors: none;
              border-color: #e5e5e5 #e5e5e5 #e5e5e5 currentcolor;
              border-image: none;
              border-radius: 0 18.5px 18.5px 0;
              border-style: solid solid solid none;
              border-width: 1px 1px 1px medium;
              color: #879aa8;
              height: 25px;
              line-height: 25px;
              min-width: 70px;
              text-align: center;
            }

             .follow-btn i {
              background-position: -96px 0;
              display: block;
              height: 13px;
              left: 9px;
              position: absolute;
              top: 6px;
              width: 14px;
            }

            .follow-btn span {
              display: block;
              font-size: 13px;
              height: 25px;
              line-height: 25px;
              padding-left: 30px;
              font-size:12px;
            }
            a, a:hover, ins {
              text-decoration: none;

            }
            .follow-btn:hover{
                color: #fff;

            }
            .nav.ace-nav a {
              color: #fff;
            }
            .fa-eye{
                color:#ff7700;
            }
            .liwu{height: 50px;}
             .getYc {
              background: #f60 none repeat scroll 0 0;
              border-radius: 9.5px;
              color: #fff;
              display: inline-block;
              float: none;
              height: 20px;
              line-height: 20px;
              padding: 0 15.5px;
              text-align: center;
              vertical-align: top;
            }
            .s_sh{
              background: url(__PUBLIC__/images/gift_background.png);
              background-repeat: no-repeat;
              background-color: #b2d8df;
            }
            .n{
                background: url(__PUBLIC__/images/icon.png);
              background-repeat: no-repeat;
                float: left;
              height: 30px;
              width: 30px;

            }

            .sign {
            background-position: 0 10px;
            }
             .n0 {
            background-position: 0 -20px;
            }
            .n1 {
            background-position: 0 -53px;
            }
            
             .n2 {
            background-position: 0 -86px;
            }
              .n3 {
            background-position: 0 -117px;
            }
              .n4 {
            background-position: 0 -149px;
            }
              .n5 {
            background-position: 0 -181px;
            }
              .n6 {
            background-position: 0 -212px;
            }
              .n7 {
            background-position: 0 -241px;
            }
              .n8 {
            background-position: 0 -270px;
            }
              .n9 {
            background-position: 0 -299px;
            }
            .mg0{
                margin:0
            }
            .page-header h1 {
                margin: 0 ;
              }

            .fr{float: right}
            .getYc:hover{color: #fff;text-decoration: none}
            #dialog
            {
                    min-height:400px;
                    background:#f8f8f8;
                    overflow: scroll;
            }
            .giftBox {
            border: 1px solid #e5e4e4;
            height: 90px;
            width: 672px;
            }
            .pd0 {
            padding: 0;
            }
            .col-sm-2.pd0 {
            width: 100px;
            }
            .page-header h1 small {
            color: #000;
            font-size: 17px;
            }
            </style>
            <script type="text/javascript" src="http://chat.mcooz.com/Applications/Chat/Web/js/swfobject.js"></script>
            <script type="text/javascript" src="http://chat.mcooz.com/Applications/Chat/Web/js/web_socket.js"></script>
            <script type="text/javascript" src="http://chat.mcooz.com/Applications/Chat/Web/js/jquery.min.js"></script>
            <script type="text/javascript">
            function removeHTMLTag(str){
                str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
                str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
                //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
                str=str.replace(/&nbsp;/ig,'');//去掉&nbsp;
                return str;
            }

            function IsPC() {
                var userAgentInfo = navigator.userAgent;
                var Agents = ["Android", "iPhone",
                            "SymbianOS", "Windows Phone",
                            "iPad", "iPod"];
                var flag = true;
                for (var v = 0; v < Agents.length; v++) {
                    if (userAgentInfo.indexOf(Agents[v]) > 0) {
                        flag = false;
                        break;
                    }
                }
                return flag;
            }

            if (typeof console == "undefined") {    this.console = { log: function (msg) {  } };}
            WEB_SOCKET_SWF_LOCATION = "http://chat.mcooz.com/Applications/Chat/Web/swf/WebSocketMain.swf";
            WEB_SOCKET_DEBUG = true;
            var ws, identity,kros_id=0,kros_name,name,agent,shipStop=1,timer=new Array(),renwu=new Array(),open_=new Array(),form_ID,playerWidth_,chatWidth,shipCount=1,openStatus=0, client_list={};
            $flag=IsPC();
            if($flag!=true){
                agent='mobile';
            }
            else{
                agent='pc'
            }
            switch(<{$Example_identity}>){
                case 0:
                   identity=''
                    break;
                case 1:
                  identity='房管'
                    break;
                 case 2:
                    identity='超管'
                    break;
                    case 3:
                   identity='系统管理员'
            }

    // 连接服务端
    function connect() {
       // 创建websocket
       ws = new WebSocket("ws://115.28.161.7:7272");
       // 当socket连接打开时，输入用户名
       ws.onopen = onopen;
       // 当有消息时根据消息类型显示不同信息
       ws.onmessage = onmessage; 
       ws.onclose = function() {
          console.log("连接关闭，定时重连");
          connect();
       };
       ws.onerror = function() {
          console.log("出现错误");
       };
    }

    // 连接建立时发送登录信息
    function onopen(){

        name="<{$Example_username}>"
      
      /*  var login_data = '{"type":"login","client_name":"'+name.replace(/"/g, '\\"')+'","room_id":"<{$id}>"';
        login_data+=',"agent":"'
        login_data+='mobile"}'*/
        
         var login_data = '{"type":"login","client_name":"'+name.replace(/"/g, '\\"')+'","room_id":"<{$id}>","agent":"<{$agent}>"}';
      
        console.log("websocket握手成功，发送登录数据:"+login_data);
        ws.send(login_data);
        
    }
    function Y(element){
    return document.getElementById(element);
    };



    function sfdf(){
        $('#rocket-to-top').css({ top:"1600px"});
        }
        function reset(){
		$('#Atlantis').css({ top:"1600px"});
	}

    $.fn.wait = function(time, type) {
        time = time || 800;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };

function selectfrom (lowValue,highValue){
var choice=highValue-lowValue+1;
return Math.floor(Math.random()*choice+lowValue);
}

function rd(n,m){
    var c = m-n+1;  
    return Math.floor(Math.random() * c + n);
}

function sdfdsfdfs(){
        $(".level-2").stop(!0).animate({
                opacity: 1
		})
	
	$("#rocket-to-top")
       

.animate({top:"786px"},48.6,"swing")
.animate({top:"784px"},48.4,"swing")
.animate({top:"782px"},48.2,"swing")
.animate({top:"780px"},48,"swing")
.animate({top:"778px"},47.8,"swing")
.animate({top:"776px"},47.6,"swing")
.animate({top:"774px"},47.4,"swing")
.animate({top:"772px"},47.2,"swing")
.animate({top:"770px"},47,"swing")
.animate({top:"768px"},46.8,"swing")
.animate({top:"766px"},46.6,"swing")
.animate({top:"764px"},46.3999999999999,"swing")
.animate({top:"762px"},46.1999999999999,"swing")
.animate({top:"760px"},45.9999999999999,"swing")
.animate({top:"758px"},45.7999999999999,"swing")
.animate({top:"757px"},45.5999999999999,"swing")
.animate({top:"756px"},45.3999999999999,"swing")
.animate({top:"755px"},45.1999999999999,"swing")
.animate({top:"754px"},44.9999999999999,"swing")
.animate({top:"753px"},44.7999999999999,"swing")
.animate({top:"752px"},44.5999999999999,"swing")
.animate({top:"751px"},44.3999999999999,"swing")
.animate({top:"750px"},44.1999999999999,"swing")
.animate({top:"749px"},43.9999999999999,"swing")
.animate({top:"748px"},43.7999999999999,"swing")
.animate({top:"747px"},43.5999999999999,"swing")
.animate({top:"746px"},43.3999999999999,"swing")
.animate({top:"745px"},43.1999999999999,"swing")
.animate({top:"744px"},42.9999999999999,"swing")
.animate({top:"743px"},42.7999999999999,"swing")
.animate({top:"742px"},42.5999999999999,"swing")
.animate({top:"741px"},42.3999999999999,"swing")
.animate({top:"740px"},42.1999999999999,"swing")
.animate({top:"739px"},41.9999999999999,"swing")
.animate({top:"738px"},41.7999999999999,"swing")
.animate({top:"737px"},41.5999999999999,"swing")
.animate({top:"736px"},41.3999999999999,"swing")
.animate({top:"735px"},41.1999999999999,"swing")
.animate({top:"734px"},40.9999999999999,"swing")
.animate({top:"733px"},40.7999999999999,"swing")
.animate({top:"732px"},40.5999999999999,"swing")
.animate({top:"731px"},40.3999999999999,"swing")
.animate({top:"730px"},40.1999999999999,"swing")
.animate({top:"729px"},39.9999999999999,"swing")
.animate({top:"728px"},39.7999999999999,"swing")
.animate({top:"727px"},39.5999999999999,"swing")
.animate({top:"726px"},39.3999999999998,"swing")
.animate({top:"725px"},39.1999999999998,"swing")
.animate({top:"724px"},38.9999999999998,"swing")
.animate({top:"723px"},38.7999999999998,"swing")
.animate({top:"722px"},38.5999999999998,"swing")
.animate({top:"721px"},38.3999999999998,"swing")
.animate({top:"720px"},38.1999999999998,"swing")
   
      
   
       
      /* for(i=800;i>300;i--){
       
       $("#rocket-to-top").animate({top:i+"px"},i*5)
       
            }*/
      
     $("#rocket-to-top") .animate({
		top:"-300px"},400,'swing',sfdf

		);
}


function Atlantis() {

//$("#rocket-to-top").css({ background: 'url("http://www.mcooz.com/Public/huojian/images/Atlantis.png")',width:"230px",height:"650px"}); 

    $("#rocket-to-top1")

    .animate({
        top: "786px"
    },
    48.6, "swing").animate({
        top: "784px"
    },
    48.4, "swing").animate({
        top: "782px"
    },
    48.2, "swing").animate({
        top: "780px"
    },
    48, "swing").animate({
        top: "778px"
    },
    47.8, "swing").animate({
        top: "776px"
    },
    47.6, "swing").animate({
        top: "774px"
    },
    47.4, "swing").animate({
        top: "772px"
    },
    47.2, "swing").animate({
        top: "770px"
    },
    47, "swing").animate({
        top: "768px"
    },
    46.8, "swing").animate({
        top: "766px"
    },
    46.6, "swing").animate({
        top: "764px"
    },
    46.3999999999999, "swing").animate({
        top: "762px"
    },
    46.1999999999999, "swing").animate({
        top: "760px"
    },
    45.9999999999999, "swing").animate({
        top: "758px"
    },
    45.7999999999999, "swing").animate({
        top: "757px"
    },
    45.5999999999999, "swing").animate({
        top: "756px"
    },
    45.3999999999999, "swing").animate({
        top: "755px"
    },
    45.1999999999999, "swing").animate({
        top: "754px"
    },
    44.9999999999999, "swing").animate({
        top: "753px"
    },
    44.7999999999999, "swing").animate({
        top: "752px"
    },
    44.5999999999999, "swing").animate({
        top: "751px"
    },
    44.3999999999999, "swing").animate({
        top: "750px"
    },
    44.1999999999999, "swing").animate({
        top: "749px"
    },
    43.9999999999999, "swing").animate({
        top: "748px"
    },
    43.7999999999999, "swing").animate({
        top: "747px"
    },
    43.5999999999999, "swing").animate({
        top: "746px"
    },
    43.3999999999999, "swing").animate({
        top: "745px"
    },
    43.1999999999999, "swing").animate({
        top: "744px"
    },
    42.9999999999999, "swing").animate({
        top: "743px"
    },
    42.7999999999999, "swing").animate({
        top: "742px"
    },
    42.5999999999999, "swing").animate({
        top: "741px"
    },
    42.3999999999999, "swing").animate({
        top: "740px"
    },
    42.1999999999999, "swing").animate({
        top: "739px"
    },
    41.9999999999999, "swing").animate({
        top: "738px"
    },
    41.7999999999999, "swing").animate({
        top: "737px"
    },
    41.5999999999999, "swing").animate({
        top: "736px"
    },
    41.3999999999999, "swing").animate({
        top: "735px"
    },
    41.1999999999999, "swing").animate({
        top: "734px"
    },
    40.9999999999999, "swing").animate({
        top: "733px"
    },
    40.7999999999999, "swing").animate({
        top: "732px"
    },
    40.5999999999999, "swing").animate({
        top: "731px"
    },
    40.3999999999999, "swing").animate({
        top: "730px"
    },
    40.1999999999999, "swing").animate({
        top: "729px"
    },
    39.9999999999999, "swing").animate({
        top: "728px"
    },
    39.7999999999999, "swing").animate({
        top: "727px"
    },
    39.5999999999999, "swing").animate({
        top: "726px"
    },
    39.3999999999998, "swing").animate({
        top: "725px"
    },
    39.1999999999998, "swing").animate({
        top: "724px"
    },
    38.9999999999998, "swing").animate({
        top: "723px"
    },
    38.7999999999998, "swing").animate({
        top: "722px"
    },
    38.5999999999998, "swing").animate({
        top: "721px"
    },
    38.3999999999998, "swing").animate({
        top: "720px"
    },
    38.1999999999998, "swing")

   
　

    $("#rocket-to-top1").animate({
        top: "-1000px"
    },
    700, 'swing', reset

    );
}


    // 服务端发来消息时
    function onmessage(e)
    {
        console.log(e.data);
       //alert(e.data)
        var data = eval("("+e.data+")");
        switch(data['type']){
            // 服务端ping客户端
            case 'ping':
                ws.send('{"type":"pong"}');
                break;;
            // 登录 更新用户列表
            case 'login':
                
                $(".num-v").html(data['online']+1);
               // alert(data['online']);
                
                 var str = ' 进入了直播间';
                //{"type":"login","client_id":xxx,"client_name":"xxx","client_list":"[...]","time":"xxx"}
               
                    
               
                say_login(data['client_id'], data['client_name'],  data['client_name']+str, data['time'],  data['agent']);

                kros_id=data['client_id'];
                kros_name=data['client_name'];

                if(data['client_list'])
                {
                    client_list = data['client_list'];
                }
                else
                {
                    client_list[data['client_id']] = data['client_name']; 
                }
                flush_client_list();
                console.log(data['client_name']+"登录成功");
                break;
            // 发言
            case 'say':
    
                //{"type":"say","from_client_id":xxx,"to_client_id":"all/client_id","content":"xxx","time":"xxx"}
                //
    /*              if(<{$Example_gag}>==0)
                {

                      say(data['from_client_id'], data['from_client_name'], data['content'], data['time']);
                   
                }
                else
                {
                   say_gag(data['from_client_id'], data['from_client_name'], data['content'], data['time']);
                   


                }*/
              //  alert(e.data)
            //alert(data['shipCount'])
           // alert(data['changeShip'])

            say(data['from_client_id'], data['from_client_name'], data['content'], data['time'], data['agent'],data['ship'],data['shipCount']);


            from_ID=data['from_client_id'];
            
            if(data['content']=="huojian")  {
                                                sdfdsfdfs();
                                             }

            if(data['content']=="Atlantis") {
                                                Atlantis();
                                            }     



          if(data['ship']==1){
          
          
                         var url = '<{:U('index/d_renwu')}>';

	$.getJSON(url,{'renwu':data['from_client_name']},function(json)
	{
        
        
        
        
                                        })
                                    
                 } 
                 //  if(data['ship']==1){
            //alert(data['from_client_id'])
                  //  changeShipCount(data['shipCount']);
                    /*  from_id=data['from_client_id'];
                                   if(open_[from_id]!=1){
                                                    shipGift(data['shipCount'],data['from_client_id']);

                                                    open_[from_id]=1;

                                                   suo()

                                              }    

                                            else{

                                                 stopSuo();

                                                   suo()

                                                }

                                }               */

 
     //alert(data['changeShip']);
     //var renwu=new Array()
      //alert(renwu.toString())
        if(data['changeShip']){

                                    //stopSuo();

                 
                 
                 
                //renwu.push(data['from_client_id'])
         /*   $(document).queue(function () {
                  gone(data['from_client_id']);
                $(this).dequeue();
              });*/
                                 
                           //  gone(data['from_client_id']);
                               
                                    //open_[1]=0;  


                                }
                          
                           
               
                           //     for(var i=0;i<renwu.length;i++){
                                
                    /*              $("#s_sh_"+id).animate({width:'0'},1,function (){
                $(this).remove();
                $(".n").remove();
                });*/
                
                
                    /*            $("#s_sh_"+renwu[i]).queue(function () {
                                     $(this).remove();
                                $(".n").remove();
                            stopSuo(renwu[i]);
                                  $(this).dequeue();
                                })
                                
                   
              
                               
                               
                               }*/
                               
                             //  renwu=[];
                               
  
                               /*  openStatus=0;
                                    stopSuo(renwu[i]);*/
                               
                                   
            

                break;
            // 用户退出 更新用户列表
            case 'logout':
                //{"type":"logout","client_id":xxx,"time":"xxx"}
                //say(data['from_client_id'], data['from_client_name'], data['from_client_name']+' 退出了', data['time']);
                delete client_list[data['from_client_id']];
                flush_client_list();
        }
    }

    function get_content(e)
    {


        console.log(e.data);
        var data = eval("("+e.data+")");

        alert(data);

        alert(0)



    }

    // 输入姓名
    function show_prompt(){  
        name = prompt('输入你的名字：', '');
        if(!name || name=='null'){  
            alert("输入名字为空或者为'null'，请重新输入！");  
            show_prompt();
        }
    }  

    // 提交对话
    function onSubmit() {  
    

      var input = document.getElementById("textarea");

/*       var to_client_id = $("#client_list option:selected").attr("value");
      var to_client_name = $("#client_list option:selected").text();*/

      if (<{$Example_gag}>==1) {

//console.log(client_list)
//alert(kros_id)
var x = "";
$("#client_list option").each(function() {
    if($(this).text() == "kros") {
        x = $(this).val();
    }
})

var to_client_id =x;


 var to_client_name = '';
      } else{
        var to_client_id = $("#client_list option:selected").attr("value");
         var to_client_name = $("#client_list option:selected").text();
      };

    /*var to_client_id ='7f00000108fc00000502';


    var to_client_name = 'kros';*/
      ws.send('{"type":"say","to_client_id":"'+to_client_id+'","to_client_name":"'+to_client_name+'","content":"'+input.value.replace(/"/g, '\\"').replace(/\n/g,'\\n').replace(/\r/g, '\\r')+'"}');
      input.value = "";
      input.focus();
    }

 // 提交对话
    function onSubmit1() {
      var input ="huojian";
      var to_client_id = $("#client_list option:selected").attr("value");
      var to_client_name = $("#client_list option:selected").text();
      ws.send('{"type":"say","to_client_id":"'+to_client_id+'","to_client_name":"'+to_client_name+'","content":"'+input.replace(/"/g, '\\"').replace(/\n/g,'\\n').replace(/\r/g, '\\r')+'"}');
    
    }

    //
        function onSubmit2() {
      var input ="Atlantis";
      var to_client_id = $("#client_list option:selected").attr("value");
      var to_client_name = $("#client_list option:selected").text();
      ws.send('{"type":"say","to_client_id":"'+to_client_id+'","to_client_name":"'+to_client_name+'","content":"'+input.replace(/"/g, '\\"').replace(/\n/g,'\\n').replace(/\r/g, '\\r')+'"}');
    
    }



    // 刷新用户列表框
    function flush_client_list(){
        var userlist_window = $("#userlist");
        var client_list_slelect = $("#client_list");
        userlist_window.empty();
        client_list_slelect.empty();
        userlist_window.append('<h4>在线用户</h4><ul>');
        client_list_slelect.append('<option value="all" id="cli_all">所有人</option>');
        for(var p in client_list){
            userlist_window.append('<li id="'+p+'">'+client_list[p]+'</li>');
            client_list_slelect.append('<option value="'+p+'">'+client_list[p]+'</option>');
        }
        $("#client_list").val(select_client_id);
        userlist_window.append('</ul>');
    }

    // 发言
    function say(from_client_id, from_client_name, content, time, agent,ship,shipCount){
                content=removeHTMLTag(content);
                    //var agent ="<{$agent}>";
                if(content=='Atlantis1'){
                   return;
                }     
                if( agent=='mobile'){
                agentHtml='<i class="fa fa-mobile fa-2x" aria-hidden="true" style="color:#428bca"></i>'
                }else{
                agentHtml='<i class="fa fa-desktop fa-2x" aria-hidden="true" style="color:#428bca"></i>'
                }
                var html='<div class="speech_item">'+agentHtml+'<span  class="identity">'+identity+'</span> '+from_client_name+':'+content+' </div>'
                 // $("#dialog").append('<div class="speech_item">'+agentHtml+'<span  class="identity">'+identity+'</span> '+from_client_name+':'+content+' </div>');
                document.getElementById("dialog").innerHTML += html;
                document.getElementById("dialog").scrollTop = document.getElementById("dialog").scrollHeight;   
                //  $("#dialog").scrollTop = $("#dialog").scrollHeight; 
                
                var shipGiftWidth=parseInt($("#s_sh_"+from_client_name).width())
                var o = document.getElementById("#s_sh_"+from_client_name);
               // var shipGiftWidth = o.offsetWidth;  //宽度
                if(ship==1){
                
                                 if(!shipGiftWidth|| shipGiftWidth=='null'||shipGiftWidth<30){

                        chatWidth=parseInt($(".thumbnail").width())+10;
                        var shipHtml='<div class="s_sh" id="s_sh_'+from_client_name+'"><div class="nbox" id="nbox"><span class="n sign"></span><span id="shipCount" class="n n'+shipCount+'"></span></div> </div>'
                        document.getElementById("dialog").innerHTML += shipHtml;
                        $("#s_sh_"+from_client_name).css({ position:"absolute",top:rd(100,500),left:"13px",width:chatWidth,height:"40px"});
                         openStatus=1
                         
                                                                }
                         
                         
                        suo(from_client_name);
                        //return;
                        //window.setTimeout(changeShip(from_client_id),2000);
                     /*  if(open_[1]!=1){ 
                      
                               suo(from_client_id);
                          
                        }
                        else{
                      
                                    window.setTimeout(function(){
                                                         stopSuo();
                                      },7000);
                                    if(openStatus==1){ 
                                    return

                                    }else{
                                      suo(from_client_id);
                                      }
                           
                             //alert(open_[1])
                              
                            }*/
                    
                   
                }

    }

        // 进入
    function say_login(from_client_id, from_client_name, content, time,agent){
      content=removeHTMLTag(content);
      
      var agentHtml;
     name="<{$Example_username}>"
     
      if(name!=''){
          
      //alert(agent)
       //var agent ="<{$agent}>";
      if( agent=='mobile'){
          
    agentHtml='<i class="fa fa-mobile fa-2x" aria-hidden="true" style="color:#428bca"></i>'
          
      }else{
      
      
      agentHtml='<i class="fa fa-desktop fa-2x" aria-hidden="true" style="color:#428bca"></i>'
                    }
          
      }
      else{
      
      agentHtml=content='';
      
                            }
      
        $("#dialog").append('<div class="speech_item">'+agentHtml+'<span  class="identity">'+identity+'</span> '+content+' </div>');
    }


            // 禁言
    function say_gag(from_client_id, from_client_name, content, time){
      content='您已被禁言';
        $("#dialog").append('<div class="speech_item"><span  class="identity">'+identity+'</span> '+content+' </div>');
    }



    $(function(){
        select_client_id = 'all';
        $("#client_list").change(function(){
             select_client_id = $("#client_list option:selected").attr("value");
        });
    });
  </script>

<script>
// * jQuery url get parameters function [获取URL的GET参数值]
// *character_set UTF-8
// * version 1.2012.12.11.1400
// *  Example
// *     <code>
// *      var GET = $.urlGet(); //获取URL的Get参数
// *      var id = GET['id']; //取得id的值
// *     </code>
(function($)
{
    $.extend(
    {
        urlGet:function()
        {
            var aQuery = window.location.href.split("?");//取得Get参数
            var aGET = new Array();
            if(aQuery.length > 1)
            {
                var aBuf = aQuery[1].split("&");
                for(var i=0, iLoop = aBuf.length; i<iLoop; i++)
                {
                    var aTmp = aBuf[i].split("=");//分离key与Value
                    aGET[aTmp[0]] = aTmp[1];
                }
            }
            return aGET;
        },
    });
})(jQuery);
</script>
<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/artTemplate/artTemplate.js"></script>
<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/artTemplate/artTemplate-plugin.js"></script>

<script>

	function goToList(Category_id)

	{
        $("#kros_follow,.kros_remove,.giftBox").remove();

		var url = '<{:U('index/krosCategoryList')}>';

		$.getJSON(url,{'Category_id':Category_id},function(json)
		{
		
			
			$("#krosrow1").empty(); 

			//alert(1)
		
			var tag;

			//var json1= json.left

			var json2=json;
                        
                        
                        if(json==null){
                        
                            
                            var cryhtml = template.render('cryTemplate',1);
                            $('#krosrow1').append(cryhtml);

                        }
                        
                        else{
                            
                            for(var item in json2)

                            {
                                    //alert(item)

                                    //console.log(1);

                                    //console.log(item);

                                    var deliveRowHtml1 = template.render('deliveInfoTemplate1',json2[item]);
                                    $('#krosrow1').append(deliveRowHtml1);

                            }
                        }

		});


	}
                                                                 
                                                                        
                                                                        
</script>
              <script type='text/html' id='deliveInfoTemplate1'>
                      <li data-id="385390" class="video-list-item video-no-tag ">
              <a data-id="385390" class="video-list-item-wrap" href="<{:U('index/krosList/id/')}><%=uid%>">
                                <div class="video-cover">
                  <img alt="" data-original="http://i7.pdim.gs/45/78b0f8c376cc018c9c24b7e3c16e5d91/w338/h190.jpg" class="video-img video-img-lazy" src="__upload__/images/<%=uid%>.jpg">
                  <div class="video-overlay"></div>
                  <div class="video-play"></div>
                </div>
                <div title="" class="video-title"><%=title%> </div>
                <div class="video-info">
                  <span class="video-nickname"><%=nicheng%></span>
                  <span class="video-number"><%=ding%></span>
                                      <span class="video-cate"><%=cate_name%></span>
                                  </div>
              </a>
            </li>
            	</script>   
        
        
                <script type='text/html' id='cryTemplate'>

                    <div>

                    <img src="__PUBLIC__/img/cry.gif">

                    <p style="font-size: 18px">对不起,没有找到直播间!</p>
                    </div>

                </script>
        
        
	</head>

	<body onload="connect();">

        <!-- 代码 开始 -->
<div style="display:block;" id="rocket-to-top">
	<div style="opacity:0;display:block;" class="level-2"></div>
	<div class="level-3"></div>
</div>
        
        <div style="display:block;" id="rocket-to-top1">
	<div style="opacity:0;display:block;" class="level-2"></div>
	<div class="level-3"></div>
</div>
<!-- 代码 结束 -->

		<div class="navbar navbar-default" id="navbar"  style="margin-bottom:0">
			<script type="text/javascript">
				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
			</script>

			<div class="navbar-container" id="navbar-container">
				<div class="navbar-header pull-left">
					<a href="<{:U('c/i')}>" class="navbar-brand">
						<small>
							  <img style="width: 266px; height: auto;" alt="VideoTouch" src="__PUBLIC__/img/logo.png">
							
						</small>
					</a><!-- /.brand -->
				</div><!-- /.navbar-header -->

				<div class="navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						
<if condition="$Example_uid!=''">
						<li class="light-blue">
              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
              
                <span class="user-info">
                  <small>Welcome,</small>
                  <{$Example_username}> 
                </span>

                <i class="icon-caret-down"></i>
              </a>

              <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                <li>
                  <a href="<{:U('Member/')}>">
                    <i class="icon-user"></i>
                    个人中心
                  </a>
                </li>

                <li class="divider"></li>
 <form action="<{:U('Login/logout')}>" name="logout_form" method="post">
                <input type="hidden" name="refer" id="refer" value="123">  

                </form>
                <li>
                  <a href="javascript:document:logout_form.submit();">
                    <i class="icon-off"></i>
                    退出
                  </a>
                </li>
              </ul>
            </li>
    <else /> 

     <form action="<{:U('Login/')}>" name="login_form" method="post">
                                                       <input type="hidden" name="refer" id="refer" value="123">  
                                                       
                                                   </form>

<div><a href="javascript:follow();" id="ts-show-login-modal1">登录</a></div>
<div><a href="javascript:follow();" id="ts-show-register-modal1">或 <span>注册</span></a></div>

         </if>
						

						
					</ul><!-- /.ace-nav -->
				</div><!-- /.navbar-header -->
			</div><!-- /.container -->
		</div>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<div class="sidebar" id="sidebar">
					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
					</script>

					<!-- #sidebar-shortcuts -->

					<ul class="nav nav-list">
						<li class="active">
							<a href="#"  id="sidebar-collapse1">
								<i class="icon-dashboard"></i>
								<span class="menu-text"> 精彩分类 </span>
							</a>
						</li>

						<li class="newList">

						<ul class="sidebar-list sidebar-list-2 clearfix"  style="margin:0" id="krosrow">

                               
             
                                  </ul>


	<script type='text/html' id='deliveInfoTemplate'>

			<li data-ename="cartoon"  class="cartoon">
							 <a href="javascript:goToList('<%=cate_id%>');" target="_top">
							<%=cate_name%>                 </a>
							</li>

		
		</script>

							
						</li>

						

						
					</ul><!-- /.nav-list -->

					<div class="sidebar-collapse" id="sidebar-collapse">
						<i class="icon-double-angle-left" onclick="close_panel();" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
					</div>

					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
					</script>
				</div>

				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="<{:U('c/i')}>">主页</a>
							</li>
							<li class="active">正在直播</li>
						</ul><!-- .breadcrumb -->

						<div class="nav-search" id="nav-search">
							<form class="form-search">
								<span class="input-icon">
									<input type="text" placeholder="h1z1" class="nav-search-input" id="nav-search-input" autocomplete="off" />
									<i class="icon-search nav-search-icon"></i>
								</span>
							</form>
						</div><!-- #nav-search -->
					</div>

					<div class="page-content">
						<div class="page-header" style="margin-top:0;border:none">
							<h1 class="col-sm-7 mg0">
                                                <div class="giftBox">
								<div class="col-sm-2 pd0"  ><img style="width:100px;height:88px" src=" __upload__/Portrait/<{$portrait}> "></div>
								<div class="col-sm-10">
<div class="col-sm-12" style="height:38px"></div>

<small>
									 <{$title}> 
								</small>
                                                    <small class="kros_remove">
                                                                                          
                                               <i class="fa fa-eye" aria-hidden="true"></i>
                                                <a class="num-v" data-anchor-info="ol-num">1681</a>
                                                                                     
                                                    </small>

<label class="pull-right inline" id="kros_follow">
                        <div class="focus-box-con clearfix">
                            <a class="r-com-btn follow-btn fl" href="javascript:follow();" title="关注" data-anchor-info="follow"><i class="icon-heart"></i><span>关注</span></a>
                            <a class="r-com-btn follow-btn yet hide fl" href="javascript:;" data-anchor-info="followed"><i></i><span>已关注</span></a>
                            <p class="r-num fl">
                                <span data-anchor-info="nic">421242</span>
                                <!-- <i class="nic"></i> -->
                            </p>
                        </div>
												
											
                                            </label></div></div>	
							</h1>

						</div><!-- /.page-header -->

						<div class="row" id="krosrow1">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->


								<div class="row">
									<div class="space-6"></div>

									<div id="player_" class="col-sm-7 ">
										

								
          
  
<!-- 	<iframe  frameborder=0 width="100%" height="100%" frameborder="0" class="kros_ifra" src="http://www.huya.com/485044468"></iframe> -->

<!--酷播优酷插件代码/开始-->
<!-- 
<script type="text/javascript" src="http://web.mcooz.com/player/images/swfobject.js"></script> 
<div id="CuPlayer" class="video" ><img src="http://web.mcooz.com/player/images/loading.gif" width="20" height="20" /> 播放器加载中,请稍等...</div>

<script type="text/javascript">
var so = new SWFObject("http://web.mcooz.com/Player/player.swf","ply","800","500","9","#000000");
so.addParam("allowfullscreen","true");
so.addParam("allowscriptaccess","always");
so.addParam("wmode","opaque");
so.addParam("quality","high");
so.addParam("salign","lt");

so.addVariable("JcScpServer","rtmp://115.28.161.7/live"); //服务器地址
//so.addVariable("JcScpVideoPath","kros"); //发布点名称
so.addVariable("JcScpVideoPath","<{$id}>"); //发布点名称



//so.addVariable("JcScpServer","rtmp://202.117.80.19:1935/live/"); //服务器地址
//so.addVariable("JcScpVideoPath","live2"); //发布点名称

so.addVariable("JcScpImg","http://web.mcooz.com/player/Images/flashChangfa2.jpg");
//so.addVariable("JcScpFile","http://web.mcooz.com/player/CuSunV2Set.asp");


so.write("CuPlayer");
</script>-->

<div id="id_video_container" style="width:100%; height:auto;"></div>
<script src="//qzonestyle.gtimg.cn/open/qcloud/video/live/h5/live_connect.js" charset="utf-8"></script>
<script type="text/javascript">
    playerWidth_=$("#player_").width();                                                                                                                                    
   (function () {
        var player = new qcVideo.Player("id_video_container", {
            "channel_id": "9896587163742516581",
            "app_id": "1252275100",
            "width" : 749,
            "height" : 408
        });
    })()
</script>
  <div class="giftBox"  >
                                        <ul class="liwu">
                                        <li class="artillery">
                                            <img class="g-img" src="__PUBLIC__/images/artillery.jpg" alt=""></li>

                                        <li class="plane"><img class="g-img" src="__PUBLIC__/images/plane.jpg" alt=""></li>
                                         <li class="ship" onclick="ship();" ><img class="g-img" src="__PUBLIC__/images/ship.jpg" alt=""></li>
                                            <li class="huojian"><img class="g-img" src="__PUBLIC__/images/rocket.jpg" alt=""></li>
                                                    <li class="Atlantis" onclick="onSubmit2();"><img class="g-img" src="__PUBLIC__/images/shuttle.jpg" alt=""></li>
                                                    
                                                   
                                                    
                                                    	
                                        </ul>	 <div class="container"  >
                                                    <div class="col-sm-10"  ></div>
                                                    <div class="col-sm-2" style="padding-right:0" >
                                                  <a class="r-com-btn getYc fr" href="#" target="_blank">充值</a>
                                                   </div>
                                                </div>
                                                </div>

									
                                    </div>



									<div class="vspace-sm"></div>

									<div class="col-sm-5"  >


									 <!-- chatStart -->
                                                                                <div class="">
                                                                           <div class="row clearfix">
                                                                               <div class="col-md-1 column">
                                                                               </div>
                                                                               <div class="col-md-11 column" >

                                                                   <div class="tabbable">
											<ul class="nav nav-tabs" id="myTab">
												<li class="active col-md-6 column" style="padding:0">
													<a data-toggle="tab" href="#home">
														<i class="green icon-flag bigger-110"></i>
														贡献周榜
													</a>
												</li>

												<li class="col-md-6 column" style="padding:0">
													<a data-toggle="tab" href="#profile">
                                                                                                                    <i class="orange icon-flag-checkered bigger-110"></i>
														贡献总榜
														
													</a>
												</li>

											
											</ul>

											<div class="tab-content">
												<div id="home" class="tab-pane active">
													<p>.</p>
												</div>

												<div id="profile" class="tab-pane">
													<p></p>
												</div>

												
											</div>
										</div>
               <div class="thumbnail">
                   <div class="caption" id="dialog" style="height:400px;overflow:scroll; overflow-x:hidden;"></div>
               </div>
<div class="chat-feat clearfix">
               <form onsubmit="onSubmit(); return false;">
                    <select style="margin-bottom:8px;display:none" id="client_list" >
                        <option value="all">所有人</option>
                    </select>
                    <textarea 

<if condition="$Example_uid==''">
  disabled="disabled" readonly="readonly"                                                                                       
</if>

class="textarea thumbnail" id="textarea" onkeydown='if(event.keyCode==13){checkEnter(event);onSubmit();}'></textarea>
           
<if condition="$Example_uid==''">
 <p class="login-inside login-inside-nologbor" data-type="log"><a class="is-log" href="javascript:follow();" data-type="login">登录</a>发弹幕，参与主播互动</p>   
</if>
     
<div class="say-btn">

<input type="submit" class="btn btn-default" value="发送" />




</div>
               </form>
                    </div>
<script>
function checkEnter(e)
{
var et=e||window.event;
var keycode=et.charCode||et.keyCode;
if(keycode==13)
{
if(window.event)
window.event.returnValue = false;
else
e.preventDefault();//for firefox
}

}
     </script>

            </div>
            <div class="col-md-3 column"   style="display:none">
               <div class="thumbnail">
                   <div class="caption" id="userlist"></div>
               </div>
               <a href="#" target="_blank"><img style="width:252px;margin-left:5px;" src="__PUBLIC__/img/logo.png"></a>
            </div>
        </div>
    </div>

 <!-- chatEnd -->

								
									</div><!-- /span -->
								</div><!-- /row -->

								<div class="hr hr32 hr-dotted"></div>

								<div class="row">
									<div class="col-sm-12">
										<div class="widget-box transparent">
										

											<div class="widget-body">
												<div class="widget-main no-padding">
													
												</div><!-- /widget-main -->
											</div><!-- /widget-body -->
										</div><!-- /widget-box -->
									</div>

								
								</div>

								<div class="hr hr32 hr-dotted"></div>

								

								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->

				<div class="ace-settings-container" id="ace-settings-container">
					<div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
						<i class="icon-cog bigger-150"></i>
					</div>

					<div class="ace-settings-box" id="ace-settings-box">
						<div>
							<div class="pull-left">
								<select id="skin-colorpicker" class="hide">
									<option data-skin="default" value="#438EB9">#438EB9</option>
									<option data-skin="skin-1" value="#222A2D">#222A2D</option>
									<option data-skin="skin-2" value="#C6487E">#C6487E</option>
									<option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
								</select>
							</div>
							<span>&nbsp; Choose Skin</span>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-navbar" />
							<label class="lbl" for="ace-settings-navbar"> Fixed Navbar</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-sidebar" />
							<label class="lbl" for="ace-settings-sidebar"> Fixed Sidebar</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-breadcrumbs" />
							<label class="lbl" for="ace-settings-breadcrumbs"> Fixed Breadcrumbs</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-rtl" />
							<label class="lbl" for="ace-settings-rtl"> Right To Left (rtl)</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-add-container" />
							<label class="lbl" for="ace-settings-add-container">
								Inside
								<b>.container</b>
							</label>
						</div>
					</div>
				</div><!-- /#ace-settings-container -->
			</div><!-- /.main-container-inner -->

			
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='__PUBLIC__/assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

                <!--[if IE]>
                <script type="text/javascript">
                 window.jQuery || document.write("<script src='__PUBLIC__/assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
                </script>
                <![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='__PUBLIC__/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="__PUBLIC__/assets/js/bootstrap.min.js"></script>
		<script src="__PUBLIC__/assets/js/typeahead-bs2.min.js"></script>

		<!-- page specific plugin scripts -->

		<!--[if lte IE 8]>
		  <script src="__PUBLIC__/assets/js/excanvas.min.js"></script>
		<![endif]-->

		<script src="__PUBLIC__/assets/js/jquery-ui-1.10.3.custom.min.js"></script>
		<script src="__PUBLIC__/assets/js/jquery.ui.touch-punch.min.js"></script>
		<script src="__PUBLIC__/assets/js/jquery.slimscroll.min.js"></script>
		<script src="__PUBLIC__/assets/js/jquery.easy-pie-chart.min.js"></script>
		<script src="__PUBLIC__/assets/js/jquery.sparkline.min.js"></script>
		<script src="__PUBLIC__/assets/js/flot/jquery.flot.min.js"></script>
		<script src="__PUBLIC__/assets/js/flot/jquery.flot.pie.min.js"></script>
		<script src="__PUBLIC__/assets/js/flot/jquery.flot.resize.min.js"></script>

		<!-- ace scripts -->

		<script src="__PUBLIC__/assets/js/ace-elements.min.js"></script>
		<script src="__PUBLIC__/assets/js/ace.min.js"></script>

		<!-- inline scripts related to this page -->

		<script type="text/javascript">
			jQuery(function($) {
				$('.easy-pie-chart.percentage').each(function(){
					var $box = $(this).closest('.infobox');
					var barColor = $(this).data('color') || (!$box.hasClass('infobox-dark') ? $box.css('color') : 'rgba(255,255,255,0.95)');
					var trackColor = barColor == 'rgba(255,255,255,0.95)' ? 'rgba(255,255,255,0.25)' : '#E2E2E2';
					var size = parseInt($(this).data('size')) || 50;
					$(this).easyPieChart({
						barColor: barColor,
						trackColor: trackColor,
						scaleColor: false,
						lineCap: 'butt',
						lineWidth: parseInt(size/10),
						animate: /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase()) ? false : 1000,
						size: size
					});
				})
			
				$('.sparkline').each(function(){
					var $box = $(this).closest('.infobox');
					var barColor = !$box.hasClass('infobox-dark') ? $box.css('color') : '#FFF';
					$(this).sparkline('html', {tagValuesAttribute:'data-values', type: 'bar', barColor: barColor , chartRangeMin:$(this).data('min') || 0} );
				});
			
			
			
			
			  var placeholder = $('#piechart-placeholder').css({'width':'90%' , 'min-height':'150px'});
			  var data = [
				{ label: "social networks",  data: 38.7, color: "#68BC31"},
				{ label: "search engines",  data: 24.5, color: "#2091CF"},
				{ label: "ad campaigns",  data: 8.2, color: "#AF4E96"},
				{ label: "direct traffic",  data: 18.6, color: "#DA5430"},
				{ label: "other",  data: 10, color: "#FEE074"}
			  ]
			  function drawPieChart(placeholder, data, position) {
			 	  $.plot(placeholder, data, {
					series: {
						pie: {
							show: true,
							tilt:0.8,
							highlight: {
								opacity: 0.25
							},
							stroke: {
								color: '#fff',
								width: 2
							},
							startAngle: 2
						}
					},
					legend: {
						show: true,
						position: position || "ne", 
						labelBoxBorderColor: null,
						margin:[-30,15]
					}
					,
					grid: {
						hoverable: true,
						clickable: true
					}
				 })
			 }
			 drawPieChart(placeholder, data);
			
			 /**
			 we saved the drawing function and the data to redraw with different position later when switching to RTL mode dynamically
			 so that's not needed actually.
			 */
			 placeholder.data('chart', data);
			 placeholder.data('draw', drawPieChart);
			
			
			
			  var $tooltip = $("<div class='tooltip top in'><div class='tooltip-inner'></div></div>").hide().appendTo('body');
			  var previousPoint = null;
			
			  placeholder.on('plothover', function (event, pos, item) {
				if(item) {
					if (previousPoint != item.seriesIndex) {
						previousPoint = item.seriesIndex;
						var tip = item.series['label'] + " : " + item.series['percent']+'%';
						$tooltip.show().children(0).text(tip);
					}
					$tooltip.css({top:pos.pageY + 10, left:pos.pageX + 10});
				} else {
					$tooltip.hide();
					previousPoint = null;
				}
				
			 });
			
			
			
			
			
			
				var d1 = [];
				for (var i = 0; i < Math.PI * 2; i += 0.5) {
					d1.push([i, Math.sin(i)]);
				}
			
				var d2 = [];
				for (var i = 0; i < Math.PI * 2; i += 0.5) {
					d2.push([i, Math.cos(i)]);
				}
			
				var d3 = [];
				for (var i = 0; i < Math.PI * 2; i += 0.2) {
					d3.push([i, Math.tan(i)]);
				}
				
			
				var sales_charts = $('#sales-charts').css({'width':'100%' , 'height':'220px'});
				$.plot("#sales-charts", [
					{ label: "Domains", data: d1 },
					{ label: "Hosting", data: d2 },
					{ label: "Services", data: d3 }
				], {
					hoverable: true,
					shadowSize: 0,
					series: {
						lines: { show: true },
						points: { show: true }
					},
					xaxis: {
						tickLength: 0
					},
					yaxis: {
						ticks: 10,
						min: -2,
						max: 2,
						tickDecimals: 3
					},
					grid: {
						backgroundColor: { colors: [ "#fff", "#fff" ] },
						borderWidth: 1,
						borderColor:'#555'
					}
				});
			
			
				$('#recent-box [data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('.tab-content')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			
			
				$('.dialogs,.comments').slimScroll({
					height: '300px'
			    });
				
				
				//Android's default browser somehow is confused when tapping on label which will lead to dragging the task
				//so disable dragging when clicking on label
				var agent = navigator.userAgent.toLowerCase();
				if("ontouchstart" in document && /applewebkit/.test(agent) && /android/.test(agent))
				  $('#tasks').on('touchstart', function(e){
					var li = $(e.target).closest('#tasks li');
					if(li.length == 0)return;
					var label = li.find('label.inline').get(0);
					if(label == e.target || $.contains(label, e.target)) e.stopImmediatePropagation() ;
				});
			
				$('#tasks').sortable({
					opacity:0.8,
					revert:true,
					forceHelperSize:true,
					placeholder: 'draggable-placeholder',
					forcePlaceholderSize:true,
					tolerance:'pointer',
					stop: function( event, ui ) {//just for Chrome!!!! so that dropdowns on items don't appear below other items after being moved
						$(ui.item).css('z-index', 'auto');
					}
					}
				);
				$('#tasks').disableSelection();
				$('#tasks input:checkbox').removeAttr('checked').on('click', function(){
					if(this.checked) $(this).closest('li').addClass('selected');
					else $(this).closest('li').removeClass('selected');
				});
			})
         //alert(renwu.toString())                    
        window.setInterval(function(){goneShip();},5000);                          
        var url = '<{:U('index/krosCategory')}>';
	$.getJSON(url,{'long':1},function(json)	{
	for(var item in json){
			var deliveRowHtml = template.render('deliveInfoTemplate',json[item]);
			$('#krosrow').append(deliveRowHtml);
		}
	});
        $("#refer").val(window.location.href);

        function follow() {
                var uid ="<{$Example_uid}>";
                if(uid==''){
                var urlVal = <{:U('Login/')}>;
                art.dialog.open(urlVal, {
                title: '登录',
                });
                $('.aui_state_focus').css({zIndex: 99999 });
                $('input[name="refer"]').val("{$refer}");
                }
                else{
                alert("已经登录");
                }
        }

        function shipGift(shipCount,fromId){
       // alert(shipCount)
       
          shipCount=shipCount.toString();
                arr = (shipCount+'').split('')
                //alert(arr[0]);   
                //alert(arr.length)
                chatWidth=parseInt($(".thumbnail").width())+10;
                if(arr.length==1){
                $('#dialog').append('<div class="s_sh" id="s_sh_'+fromId+'"><div class="nbox" id="nbox"><span class="n sign"></span><span id="shipCount" class="n n'+shipCount+'"></span></div> </div>');
                }
                if(arr.length==2){
                single=arr[1];
                $('#dialog').append('<div class="s_sh" id="s_sh_'+fromId+'"><div class="nbox" id="nbox"><span class="n sign"></span><span class="n n1"></span><span id="shipCount" class="n n'+single+'"></span></div> </div>');
                }
                $("#s_sh_"+fromId).css({ position:"absolute",top:rd(100,500),left:"13px",width:"0px",height:"40px"});
                $("#s_sh_"+fromId).animate({width:chatWidth},1);
        }
        
        function changeShipCount(i){  
                i=i.toString();
                arr = (i+'').split('')
                if(arr.length==1){
                $('#shipCount').removeClass("n"+(i-1)).addClass("n"+i);
                }
                if(arr.length==2){
                 single=arr[1];
                 ten=arr[0];
                if(i=="10"){
                   $("#shipCount").removeClass("n9").addClass("n0");
                   $("#shipCount").before('<span class="n n1" id="ten"></span>');                    
                    
                }else   {
                
                       $('#ten').removeClass("n"+(ten-1)).addClass("n"+ten);
                        $('#shipCount').removeClass("n"+(single-1)).removeClass("n9").addClass("n"+single); 
                        }
                }
        }

        function doGone(){
                //window.setTimeout(gone,2000);
                gone();
        }
                                
                                
        function gone(id){
                $("#s_sh_"+id).animate({width:'0'},1,function (){
                $(this).remove();
                $(".n").remove();
                });
        }
                                

        function ship(){
                var input ="送出了一个轮船!";
                open_[1]=1
                var ship=1
                var to_client_id = $("#client_list option:selected").attr("value");
                var to_client_name = $("#client_list option:selected").text();
                ws.send('{"type":"say","ship":1,"shipCount":1,"to_client_id":"all","to_client_name":"'+to_client_name+'","content":"'+input.replace(/"/g, '\\"').replace(/\n/g,'\\n').replace(/\r/g, '\\r')+'"}');
        }
        
        function shipSay(from_client_id, from_client_name, ship,shipCount,isOpen){
                var html='<div class="s_sh" id="s_sh_'+from_client_id+'"><div class="nbox" id="nbox"><span class="n sign"></span><span id="shipCount" class="n n'+shipCount+'"></span></div> </div>'
                 $("#s_sh_"+from_client_id).css({ position:"absolute",top:rd(100,500),left:"13px",width:chatWidth,height:"40px"});
                  document.getElementById("dialog").innerHTML += html;
        }
    
        function changeShip(from_id){ 
        var url = '<{:U('index/renwu')}>';
	$.getJSON(url,{'renwu':from_id},function(json)
	{
        });
              open_[1]=0
        }  
        
        function suo(id){        
               timer[id]= window.setTimeout(function(){changeShip(id);},2000); 
                   
                  // alert( open_[1])
              
        }        
                                
        function stopSuo(id) {  
        
                window.clearInterval(timer[id]);         
        }   
        
        function goneShip() {
        var url = '<{:U('index/q_renwu')}>';
            $.getJSON(url,{'renwu':1},function(json){
                for(var item in json) {
                       // alert(json[item].renwu);
                    $("#s_sh_"+json[item].renwu).remove()
                       // stopSuo(json[item].renwu);
                }
            });
        }
        </script>
	</body>
</html>
